//
//  MyInfoTableViewCell.m
//  Mtime2.0
//
//  Created by 凉气的Mac on 16/9/21.
//  Copyright © 2016年 凉气的Mac. All rights reserved.
//

#import "MyInfoTableViewCell.h"

#import "MtimeButton2.h"

@interface MyInfoTableViewCell ()

@property(nonatomic,strong)  NSArray *imageArray;

@property(nonatomic,strong)  NSArray *titleArray;

@end

@implementation MyInfoTableViewCell

-(NSArray *)imageArray{
    
    if (_imageArray == nil) {
        
        _imageArray = @[[UIImage imageNamed:@"icon_myInfo_cell0"],[UIImage imageNamed:@"icon_my_movie_order"],[UIImage imageNamed:@"icon_myInfo_cell2"],[UIImage imageNamed:@"icon_myInfo_cell3"]];
    }
    
    return _imageArray;
}

-(NSArray *)titleArray{
    
    if (_titleArray == nil) {
        
        _titleArray = @[@"购物车",@"电影票订单",@"商品订单",@"礼品卡"];
    }
    
    return _titleArray;
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        [self setupUI];
    }
    
    return self;
}

#pragma mark --
#pragma mark --设置界面
-(void)setupUI{
    
    CGFloat margin = 30;
    
    CGFloat btnWH = (kScreen.size.width - 5 * margin) / 4;
    
    for (int i = 0; i < 4; i ++) {
        
        CGFloat btnX = margin + i * (btnWH+margin);
        
        MtimeButton2 *button = [[MtimeButton2 alloc]init];
        
        [button setImage:self.imageArray[i] forState:UIControlStateNormal];
        
        [button setTitle:self.titleArray[i] forState:UIControlStateNormal];
        
        [button setTitleColor:[UIColor colorWithWhite:0.800 alpha:1.000] forState:UIControlStateNormal];
        
        [self.contentView addSubview:button];
        
        [button mas_makeConstraints:^(MASConstraintMaker *make) {
            
            make.top.equalTo(self.contentView).offset(10);
            
            make.bottom.equalTo(self.contentView).offset(-10);
            
            make.left.equalTo(self.contentView).offset(btnX);
            
            make.height.equalTo(button.mas_width).offset(btnWH);
            
            make.width.equalTo(button.mas_height).offset(-20);
            
        }];
        
    }
    
}

@end
